package com.jfire.socket.socketserver.transfer.server;

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import javax.annotation.Resource;
import com.jfire.socket.socketserver.bus.ServerChannelInfo;

@Resource
public class ServerStatus
{
    private Queue<ServerChannelInfo> messages = new ConcurrentLinkedQueue<>();
    private boolean        record   = false;
    
    public Queue<ServerChannelInfo> getMessages()
    {
        return messages;
    }
    
    public void add(ServerChannelInfo msg)
    {
        if (record)
        {
            messages.add(msg);
        }
    }
    
    public void remove(ServerChannelInfo message)
    {
        if (record)
        {
            messages.remove(message);
        }
    }
    
    public boolean isRecord()
    {
        return record;
    }
    
    public void setRecord(boolean record)
    {
        this.record = record;
    }
    
}
